package cn.itsource.base.util;

import cn.hutool.http.HttpUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SmsUtils {
    @Value("${sms.username}")
    private String username;
    @Value("${sms.key}")
    private String key;
    private static String smsUrl = "https://utf8api.smschinese.cn/?Uid=%s&Key=%s&smsMob=%s&smsText=验证码:%s";

    public void sendMsg(String smsMob,String smsText){
        String format = String.format(smsUrl, username, key, smsMob, smsText);
        String s = HttpUtil.get(format);
        System.out.println(s);
    }
}
